﻿using Adnc.WebApi.Shared;
using Microsoft.AspNetCore.Mvc;
using WYT.Pro.Application.Contracts.Dtos.Logistics;
using WYT.Pro.Application.Contracts.Services;

namespace WYT.Pro.WebApi.Controllers
{
    /// <summary>
    /// 商品运算服务
    /// </summary>
    [Route("pro/[Controller]")]
    [ApiController]
    public class PostageController : AdncControllerBase
    {

        private readonly ILogisticsAppService _logisticsAppService;

        public PostageController(ILogisticsAppService logisticsAppService)
        {
            _logisticsAppService = logisticsAppService;
        }

        /// <summary>
        /// 计算商品邮费
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("Postage")]
        public async Task<WYTActionResult<PostageDto>> PostageCalculation(PostageCalculationDto input)
        {
            return Success(await _logisticsAppService.PostageCalculation(input));
        }

        /// <summary>
        /// 计算商品邮费
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("_Postage")]
        public async Task<ActionResult<PostageDto>> _PostageCalculation(PostageCalculationDto input)
        {
            return Result(await _logisticsAppService.PostageCalculation(input));
        }
    }
}
